SpatialStream® Code Examples

Simple Click Identify

This example shows how to add click identify capability to the parcel layer in your application using
the GetByGeometry functional component. When the map is clicked, an "On Mouse Click" event is
triggered and a GetByGeometry query constructed using the latitude longitude values at the click location.
The returned result includes the geometry of the parcel at the click location, which is used to
highlight the parcel geometry on the map.

GetByGeometry

var resource = "samplesite.dmp/parcels";

var url = "getByGeometry.aspx" +
"?returnGeoType=1" +
// the resource are we working with
"&dataSource=" + resource +
// the point from the click event (WKT)
"&geo=POINT(" + LL.longitude + " " + LL.latitude + ")" +
// nested = true will nest the related records with the base records.This makes the result easier to work with
"&nested=true" +
// showschea= false will tell the service to return the schema information. This can be tured to true during developemnt but should stay false
// in production becuase it will lessen the payload from the result giving better performance.
"&showSchema=false" +
// the wild card will return all fields in the base resource (parcels), below we specify the feilds that we want to return
"&fields=APN,FIPS,LOCID" +
"&ss_candy=" + Dmp.Env.Connections["SS"]._candy;

//----------------

var highlightLayer = new Dmp.Layer.WMSLayer(layerName, "SS",
{
showField: keyField, showValues: keyValue, antiAlias: true, ignoreHoles: true
});
highlightLayer.addChild(highlightId, resource, SLD,
{
zoomRange: {
min: 10, max: 19
}
});
// add the layer to the map
map.addEntity(highlightLayer);


Run Sample   Back To Index